<template>
	<div class="tpl29-nav"   
   :style="tplItemData.modulePadding || tplItemData.modulePadding ==0?'padding-top:'+tplItemData.modulePadding+'px;padding-bottom:'+tplItemData.modulePadding+'px;':'padding-top:5px;padding-bottom:5px;'">
    <section :class="['mod-imgNav', 'col'+tplItemData.dataset.length]">
      <a  v-for="(item,index) in tplItemData.dataset" :key="index" @click="openLink(item.link)" class="bdbox">
          <p><img :src="item.pic" class="lazyload" alt=""></p>
          <p class="txt" v-if="item.subtitle">{{item.subtitle}}</p>
          <p class="txt" v-if="item.showtitle">{{item.showtitle}}</p>
      </a>
    </section>
  </div>
</template>

<script>
import Vue from 'vue'
import { openPage } from '@/utils/utils'
export default Vue.extend({
  name: 'index',
  data() {
    return {
    }
  },
  props: {
    tplItemData: {
      type: Object // 传入参数的类型
    }
  },
  methods: {
    // TODO 小程序跳转
    openLink(link) {
        openPage(link)
    }
  },

  created() {

  }
})
</script>

<style lang='scss'>
 @import "src/styles/mixin";
.tpl29-nav{
  .mod-imgNav {
    overflow: hidden;
    &.col4 a {
        width: 23%;
    }
    &.col3 a {
        width: 31.3%;
    }
    &.col2 a {
        width: 48%;
    }
    &.col1 a {
        width: 100%;
    }
    a {
        display: block;
        float: left;
        width: 18%;
        margin:0 1%;
        img {
          width: 100%;
          height: auto;
      }
      .txt {
          color: #646464;
          text-align: center;
          height: 40px;
          line-height: 40px;
          white-space: nowrap;
          text-overflow: ellipsis;
          overflow: hidden;
      }

    }
  }
}

</style>
